import request from '@/utils/request';

/**
 * 查询商品列表
 *
 * @param {object} query
 */
export const listProduct= (query:any) => {
	return request({
		url: '/rwmanage/library/list',
		method: 'get',
		params: query
	});
};

/**
 * 查询商品详细
 *
 * @param {string} id
 */
export const getProduct= (id:string) => {
	return request({
		url: '/rwmanage/library/' + id,
		method: 'get'
	});
};

/**
 * 新增商品
 *
 * @param {object} data
 */
export const addProduct= (data:any) => {
	return request({
		url: '/rwmanage/library/add',
		method: 'post',
		data: data
	});
};

/**
 *  修改商品
 *
 * @param {object} data
 */
export const updateProduct= (data:any) => {
	return request({
		url: '/rwmanage/library/edit',
		method: 'put',
		data: data
	});
};

/**
 * 删除商品
 *
 * @param {string} id
 */
export const delProduct= (id:string) => {
	return request({
		url: '/rwmanage/library/' + id,
		method: 'delete'
	});
};

// /**
//  * 导出商品
//  *
//  * @param {object} query
//  */
// export const exportProduct= (query:any) => {
// 	return request({
// 		url: '/rwmanage/library/export',
// 		method: 'get',
// 		params: query
// 	});
// };

/**
 * 导出商品(返回流)
 *
 * @param {object} query
 */
export const exportProduct= (query:any) => {
	return request({
		url: '/rwmanage/library/exportByStream',
		method: 'post',
		data: query
	});
};
